<?php
include_once(dirname(__FILE__).'/config.php');

$store = ARC2::getStore($arc_config);

$q = 'SELECT * WHERE {
  	?s <http://desanti.org/schemas/vocabularies#hasClass> ?class .
}';

$rs = $store->query($q);
if(!$store->getErrors()){
	$rows = $rs['result']['rows'];
	$q = 'INSERT INTO <http://desanti.org/> {' . "\n";
	for($i = 0; $i<sizeof($rows); $i++){
		$q .= '<'.$rows[$i]['class'].'> rdf:type <http://desanti.org/schemas/vocabularies#Class> .'."\n";
	}
	$q .= '}';
	$store->query($q);
	if(!$store->getErrors()){
		echo 'OK';
	}else{
		print_r($store->getErrors());
	}
}
?>
